
//
//  DealModel.m
//  Food choices
//
//  Created by xalo on 16/2/26.
//  Copyright © 2016年 张广斌. All rights reserved.
//

#import "DealModel.h"
#import "ShopModel.h"

@implementation DealModel

-(void)setValue:(id)value forKey:(NSString *)key
{
    [super setValue:value forKey:key];
    
    if ([key isEqualToString:@"shops"]) {
        
        NSArray *shopsArray = value;
        
        for (NSDictionary *shopDic in shopsArray) {
            
            ShopModel *shopModel = [[ShopModel alloc] init];
            
            [shopModel setValuesForKeysWithDictionary:shopDic];
            
            [self.shops addObject:shopModel];
        }

    }
    
    
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"description"]) {
        
        self.introduce = value;

    }
}

//懒加载
-(NSMutableArray *)shops
{
    if (!_shops) {
        self.shops = [NSMutableArray array];
    }
    return _shops;
}

@end
